xend: Device duplicate check fix
authorKeir Fraser <keir.fraser@citrix.com>
Wed, 27 May 2009 10:28:45 +0000 (11:28 +0100)
committerKeir Fraser <keir.fraser@citrix.com>
Wed, 27 May 2009 10:28:45 +0000 (11:28 +0100)
commit07943d8e2dce64ae13b0bbf5f7caccd6b15c87a2
tree8e1184be500a0b0c81db734260a189ae9cd05b0a
parentc1134c228ca3bd802f867572d33be043f4a56442
xend: Device duplicate check fix

I've checked the duplicate-check code here and I found that's checked
only in the context of one domain but not cross-domain. The thing is
that we should check tap/vbd device cross-domain not to allow another
guest to use the same disk image in some circumstances to prevent VM's
disk corruption.

The patch included denies disk image addition under those
circumstances:

1. We're adding read-only disk that's already used as write-exclusive

2. We're adding write-shared disk that's already used as
write-exclusive

3. We're adding write-exclusive disk that's already used

4. We're adding read-only disk that's already used as write-shared*
(because of I/O caching issues etc.)

The vif device duplicate check remains the same it was and it's
checked in the context of current domain only so that behaviour has
been preserved.

Signed-off-by: Michal Novotny <minovotn@redhat.com>
tools/python/xen/xend/XendConfig.py